home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / x / volume3 / awm2 / part08 < prev    next >
Encoding:
Internet Message Format  |  1989-02-20  |  55.4 KB

  1. Path: uunet!lll-winken!ames!pasteur!ucbvax!decwrl!wyse!mikew
  2. From: mikew@wyse.wyse.com (Mike Wexler)
  3. Newsgroups: comp.sources.x
  4. Subject: v03i024:  Ardent Window Manager, Patchlevel 9, Part08/12
  5. Message-ID: <2074@wyse.wyse.com>
  6. Date: 20 Feb 89 22:24:58 GMT
  7. Organization: Wyse Technology, San Jose
  8. Lines: 1771
  9. Approved: mikew@wyse.com
  10.  
  11. Submitted-by: kmw@ardent (Ken Wallich)  
  12. Posting-number: Volume 3, Issue 24
  13. Archive-name: awm2/part08
  14.  
  15. #! /bin/sh
  16. # This is a shell archive.  Remove anything before this line, then unpack
  17. # it by saving it into a file and typing "sh file".  To overwrite existing
  18. # files, type "sh file -c".  You can also feed this as standard input via
  19. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  20. # will see the following message at the end:
  21. #        "End of archive 8 (of 12)."
  22. # Contents:  CHANGES Gadget.c GridBox.c Makefile Move.c
  23. #   bitmaps/titlehilite.bm menus/menu.def.h
  24. # Wrapped by mikew@wyse on Fri Feb 17 10:50:29 1989
  25. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  26. if test -f 'CHANGES' -a "${1}" != "-c" ; then 
  27.   echo shar: Will not clobber existing file \"'CHANGES'\"
  28. else
  29. echo shar: Extracting \"'CHANGES'\" \(9162 characters\)
  30. sed "s/^X//" >'CHANGES' <<'END_OF_FILE'
  31. XThis file last changed: 8/17/88
  32. X
  33. XThe most recent changes to awm include:
  34. X
  35. XInvalid free() removed from gram.y.
  36. XTransient window placement fixed.
  37. XSignal handling done correctly for system V.
  38. X
  39. XPrevious changes to awm:
  40. X
  41. XChanges as of 7/2/88:
  42. X
  43. XBorder/title context rationalized, you may now have border contexts without
  44. Xntitle bars and vice-versa.
  45. X
  46. XThe whole paradigm for adding/removing various decorations has changed.
  47. XFunctions such as f.notitle and f.gadget have been replaced with the
  48. Xtwo functions f.decorate and f.nodecorate for reasons of simplicity.
  49. XIt's now possible to specify on an application-by-application (or class-by
  50. Xclass) basis which "decorations" not to use. See the SPECIAL RESOURCES
  51. Xsection of the man page for more information.
  52. X
  53. XFocus In/Out and Enter/Leave event handling now much more robust and
  54. Xhighlighting occurs when it should.
  55. X
  56. Xf.unfocus added for twm compatibility (not to mention general convenience).
  57. X
  58. XThe window name is now centered correctly in the titlebar (the net result
  59. Xbeing that the titlebar background doesn't creep around the edges the way
  60. Xit used to).
  61. X
  62. Xdef.awmrc/system.awmrc ambiguity finally resolved in favor of system.awmrc.
  63. XThe man page and makefile should now agree on this one.
  64. X
  65. XMany bugs and general nits fixed.
  66. X
  67. XTwo lines of whitespace added after #ident lines to keep patch from
  68. Xincluding them in context information (for those who have removed them).
  69. X
  70. XThings have been sped up a bit.
  71. X
  72. XVersion numbers set to 1.1 in all files. Subsequent versions of awm will
  73. Xincrement this accordingly (major_release.fix_level).
  74. X
  75. XMenus should now work on color systems.
  76. X
  77. XWeird nit with XGetClassHint() that caused coredumps fixed.
  78. X
  79. XMan page re-written substantially (Thanks to Bill Wohler), the format
  80. Xof the resource descriptions below reflect part of his changes.
  81. X
  82. XNew make rule "noident" added for awm and awm/menus makefile. Doing
  83. Xa "make noident" in the awm directory will remove all #ident lines from
  84. Xawm and the menus. We use #ident at ardent without trouble (and on the
  85. Xsuns), but it seems to choke DEC's compilers. I'm not sure if this
  86. Xis legal ansi anymore or not. In any case, if #ident chokes your compiler,
  87. Xthis will remove it.
  88. X
  89. XNew resources:
  90. X
  91. XFrameFocus (boolean) ``off''
  92. X Specifies whether or not focus changes should be looked for on the
  93. X client window (as they are now) or on the frame.
  94. X In a nutshell, if you set this to "off", the window will be not
  95. X change state (be this highlight or stacking level) until you've
  96. X left the frame (this includes the title bar) entirely. Correspondingly,
  97. X enter highlight/autoraise is also done on the whole frame.
  98. X This resource also has the side-effect of making the focus follow the
  99. X pointer explicitly. Thus typing into titlebars will cause the keyboard input
  100. X to go to the client window as expected.
  101. Xborder.foreground (string) ``foreground''
  102. X Lets you specify the border color for awm's "frame" windows.
  103. X
  104. X
  105. XChanges as of 6/6/88
  106. XNew resources:
  107. X
  108. XwindowName.offset: (int)
  109. X Specifys an offset for the window name, rather than
  110. X centering it.
  111. X
  112. Xtitle.height: (int)
  113. X Allows you to physically set the height of titlebars (in pixels)
  114. X to some value, rather than having it be derived from the size of
  115. X the title font(s).
  116. X
  117. Xgadget.border: (int)
  118. X Allows you to set the width of gadget box borders to some
  119. X value.
  120. X
  121. Xborder.hilite: (boolean)
  122. X Specifies whether or not to change border colors on focus in/out.
  123. X If this is undefined, and hilite is, it is set to the value of
  124. X hilite. Since is was already possible to specify whether or not
  125. X the window name and title background would be affected by focus
  126. X changes, this resource rounds out the list.
  127. X
  128. XFor demonstration purposes are two files "twm.awmrc" and "twm.Xdefaults"
  129. Xthat can be used to make awm look very much like twm. If you want to try
  130. Xthis out, edit twm.Xdefaults so that the awm.path variable points to
  131. X/.../awm/bitmaps and load it into your resource manager.
  132. X
  133. X
  134. XA few more bugs were fixed. Pixmap icons should now stay sane.
  135. XBad gravity specifications should be handled gracefully.
  136. Xcursor glyph gadget boxes should now be the correct size.
  137. XA problem with FocusChange was fixed.
  138. XThe restriction of compiling XRdBitFD only with Xlib has been lifted.
  139. X
  140. XAutoselect now works in submenus. Menu item positioning has been
  141. Ximproved.
  142. X
  143. XChanges as of 6/3/88:
  144. X
  145. XBug fixes/enhancements for first release.
  146. X
  147. XA new context named "border" has been added. When enabled (by giving it a width, see
  148. Xman page), it results in an artificial border area to which actions may be bound.
  149. XSee the man page for information on configuring this.
  150. X
  151. XIt is now possible to bind to "text action" strings in the same manner as functions
  152. Xand menus. Specifically, you may now invoke programs and manipulate the cut buffer
  153. Xdirectly through bindings rather than having to go through menus. See the man
  154. Xpage for a more thorough explanation.
  155. X
  156. XCursors for title bars and border contexts (new) are now definable resources.
  157. X
  158. X"resizeRelative" option from R2 uwm folded in along with uwm bug fixes.
  159. X
  160. XNew title.push option allows you to specify whether you want titles to push windows
  161. Xdown to make room (the default) or be added on top without moving them.
  162. X
  163. XSupport for the RTL Neaten package has been added. See the README file if you
  164. Xwish to compile it in.
  165. X
  166. XTo avoid some confusion, it's now manadatory that you compile XRdBitFD.c into Xlib.
  167. XSeperate compilation is no longer supported. The resulting inconvenience is relatively
  168. Xminor compared to what some people with irregular source trees experienced when trying
  169. Xto compile it as part of awm.
  170. X
  171. XMany bugs have been fixed, most notably a race condition on window mapping,
  172. Xmapping/unmapping of windows, bogus event masks to gadgets, resize weirdness,
  173. Xrubber banding and a number of coordinate botches that resulted from
  174. Xadding frames around things. It's now possible to compile awm with gcc 1.22,
  175. Xthough I don't know about the neaten package.
  176. X
  177. X
  178. XBug fixes to Beta.3
  179. X
  180. XDEF_FONT is now in awm.h where it belongs and GetFontRes() has been
  181. Xmodified to use it.
  182. X
  183. XSome of the default specs in awm.h have been ifdef'd so that you can
  184. Xalso specify them at compile time. Currently, you can do this for the font specs:
  185. X
  186. XNAME            Default value
  187. X----            -------------
  188. XDEF_FONT        "fixed"
  189. XDEF_TITLE_FONT        "vtsingle"
  190. XDEF_ICON_FONT        "8x13"
  191. XDEF_POPUP_FONT        "9x15"
  192. XDEF_GADGET_FONT        "fixed"
  193. XDEF_MENU_FONT        "8x13"
  194. XDEF_BOLD_FONT        "8x13bold"
  195. X
  196. XAnd the name and class of awm:
  197. X
  198. XNAME            "awm"
  199. XCLASS            "Wm"
  200. X
  201. XIt's still suggested that you change them in awm.h when you're configuring
  202. Xawm for your site, but this gives you an additional way of setting them.
  203. X
  204. XChanges for beta release 3.
  205. X
  206. X1. Total rewrite of Iconify.c and NewIconify, problems fixed are iconic
  207. Xstartup, icon/window positioning, icon_mask hints.
  208. X
  209. X2. Each gadget may now have its own font, rather than having to
  210. Xuse a global gadget font (though this is still the default).
  211. XNon-printable characters can also now be specified, allowing you
  212. Xto grab individual glyphs out of fonts and use them in gadgets.
  213. XThe is probably most useful for getting things out of the cursor font.
  214. XSee the man page for details.
  215. XNote: Though much of the necessary code is in place, it still is not
  216. Xpossible to use 16 bit fonts for this purpose. Though I'd love
  217. Xto have gadgets containing Kanji glyphs (a picture is worth a thousand
  218. Xwords, especially in Kanji) and the like, I still don't know enough
  219. Xabout the mechanism to know how and when to use the X*Text*16 routines,
  220. Xor how to store the "string" in such a way that it could be
  221. Xpainted into an 8 bit font as well.
  222. X
  223. X3. Overall structure of the window manager has changed slightly.
  224. XThe code should be easier to read and debug.
  225. X
  226. X4. New "wall" boolean allows you to constrain moves to the edges of
  227. Xthe screen.
  228. X
  229. X5. Some things that should have been getting their colors out of
  230. Xthe resource database now do.
  231. X
  232. X6. Window name and class are now both checked when determing whether
  233. Xor not to title a window.
  234. X
  235. X7. Icons now use save-unders.
  236. X
  237. X8. Certain operations should be faster.
  238. X
  239. X9. The man page has been made more readable and updated somewhat.
  240. X
  241. X
  242. XCHANGES OVER UWM:
  243. X
  244. XThis window manager represents a fairly large departure from uwm
  245. Xin the following ways:
  246. X
  247. X o    There are title bars and gadget boxes that represent fully independent
  248. X    contexts now (I.E. you can bind to them without conflict).
  249. X
  250. X o    Icons now represent a truly independent context.
  251. X
  252. X o    The menus have changed completely to allow walking menus and
  253. X    more flexibility as to contents (pictures or text) of individual panes.
  254. X    The menu interface has also been de-coupled somewhat from awm so
  255. X    that another menu package could be substituted at a
  256. X    later date. When an "official" toolkit menu widget exists, this
  257. X    will probably happen.
  258. X
  259. X o    Boolean variables may be set within menus and are also displayed
  260. X    with a checkmark (depending on whether or not they're set).
  261. X
  262. X o    Some effort is made to use save-unders and/or to minimize expose
  263. X    events due to window manager actions.
  264. X
  265. X o    Autoraise and border highlighting are available on focus.
  266. X
  267. X o    Almost everything has been moved out of the .awmrc file and into
  268. X    the resource database where it belongs.
  269. X
  270. X o    awm now supports a startup file that makes usage from xinit more
  271. X    friendly.
  272. X
  273. END_OF_FILE
  274. if test 9162 -ne `wc -c <'CHANGES'`; then
  275.     echo shar: \"'CHANGES'\" unpacked with wrong size!
  276. fi
  277. # end of 'CHANGES'
  278. fi
  279. if test -f 'Gadget.c' -a "${1}" != "-c" ; then 
  280.   echo shar: Will not clobber existing file \"'Gadget.c'\"
  281. else
  282. echo shar: Extracting \"'Gadget.c'\" \(9031 characters\)
  283. sed "s/^X//" >'Gadget.c' <<'END_OF_FILE'
  284. X
  285. X
  286. X
  287. X#ifndef lint
  288. Xstatic char *rcsid_Gadget_c = "$Header: /usr/graph2/X11.3/contrib/windowmgrs/awm/RCS/Gadget.c,v 1.2 89/02/07 20:04:53 jkh Exp $";
  289. X#endif  lint
  290. X
  291. X#include "X11/copyright.h"
  292. X/*
  293. X *
  294. X * Copyright 1987, 1988 by Ardent Computer Corporation, Sunnyvale, Ca.
  295. X *
  296. X * Copyright 1987 by Jordan Hubbard.
  297. X *
  298. X *
  299. X *                         All Rights Reserved
  300. X *
  301. X * Permission to use, copy, modify, and distribute this software and its
  302. X * documentation for any purpose and without fee is hereby granted,
  303. X * provided that the above copyright notice appear in all copies and that
  304. X * both that copyright notice and this permission notice appear in
  305. X * supporting documentation, and that the name of Ardent Computer
  306. X * Corporation or Jordan Hubbard not be used in advertising or publicity
  307. X * pertaining to distribution of the software without specific, written
  308. X * prior permission.
  309. X *
  310. X */
  311. X
  312. X/*
  313. X * MODIFICATION HISTORY
  314. X *
  315. X * 001 -- Jortan Hubbard, Ardent Computer.
  316. X * Gadget boxes in title bars.
  317. X * 1.2 -- Jordan Hubbard, Ardent Computer.
  318. X *  GadgetBorders used in placement calculations, initial
  319. X *  gadget positions calculated correcly. (Chris Thewalt fixes).
  320. X * 1.3 -- Color handling changed to deal with multiple colormaps.
  321. X * 1.4 -- Fixed really silly bug with gadget offset.
  322. X *
  323. X */
  324. X
  325. X#include "awm.h"
  326. X
  327. X#include "X11/Xutil.h"
  328. X
  329. Xextern XContext AwmContext;
  330. Xvoid PaintGadgets();
  331. X
  332. XAwmInfoPtr IsGadgetWin(w, gnum)
  333. XWindow w;
  334. Xint *gnum;
  335. X{
  336. X     AwmInfoPtr awi;
  337. X     int i;
  338. X
  339. X     Entry("IsGadgetWin")
  340. X
  341. X     if (!XFindContext(dpy, w, AwmContext, (caddr_t *) &awi)) {
  342. X          if (!awi->gadgets)
  343. X               Leave((AwmInfoPtr)NULL)
  344. X      for (i = 0; i < NumGadgets; i++)
  345. X           if (awi->gadgets[i] == w) {
  346. X                    if (gnum)
  347. X                    *gnum = i;
  348. X                Leave(awi)
  349. X               }
  350. X     }
  351. X     Leave((AwmInfoPtr)NULL)
  352. X}
  353. X
  354. X/*
  355. X * This routine adds and/or places  gadgets onto a title bar.
  356. X */
  357. Xint PutGadgets(w)
  358. XWindow w;
  359. X{
  360. X     int i, dir;
  361. X     int rx, lx, nx, ny;
  362. X     XWindowAttributes xwa;
  363. X     XSetWindowAttributes swa;
  364. X     Colormap cmap;
  365. X     unsigned long valuemask;
  366. X     GadgetDecl *gdec;
  367. X     AwmInfo *awi;
  368. X     Boolean change = FALSE;
  369. X     Window tmp;
  370. X
  371. X     Entry("PutGadgets")
  372. X
  373. X     /* are there any gadgets declared? */
  374. X     if (NumGadgets < 1)
  375. X      Leave_void
  376. X     /* does this window have a title? */
  377. X     if (!(awi = IsTitled(w)))
  378. X      Leave_void
  379. X
  380. X     if (!(awi->attrs & AT_GADGETS))
  381. X      Leave_void
  382. X     /* if the window already has gadgets, this is a reshuffle */
  383. X     if (awi->gadgets)
  384. X      change = TRUE;
  385. X     else
  386. X      awi->gadgets = (Window *)malloc(sizeof(Window) * NumGadgets + 1);
  387. X     if (!awi->gadgets) {
  388. X      fprintf(stderr, "PutGadgets: Can't allocate memory for gadgets!\n");
  389. X          Leave_void
  390. X     }
  391. X     if (XGetWindowAttributes(dpy, awi->title, &xwa) == BadWindow) {
  392. X      fprintf(stderr, "PutGadgets: Can't get attrs for client window %x\n",
  393. X          w);
  394. X      Leave_void
  395. X     }
  396. X     /* define some initial positioning information */
  397. X     dir = RightGadgetGravity;
  398. X     lx = 0;
  399. X     rx = xwa.width;
  400. X     cmap = xwa.colormap;
  401. X     valuemask = CWBackPixel | CWEventMask | CWColormap;
  402. X     swa.event_mask = (ButtonPressMask | ButtonReleaseMask | ExposureMask);
  403. X     swa.colormap = cmap;
  404. X     for (i = 0; i < NumGadgets && Gadgets[i]; i++) {
  405. X      gdec = Gadgets[i];
  406. X
  407. X      /* Does gadget have its own gravity? */
  408. X      if (gdec->gravity != NoGadgetGravity)
  409. X           dir = gdec->gravity;
  410. X      ny = xwa.height - gdec->high;
  411. X      if (ny <= 0)
  412. X               gdec->high = xwa.height;
  413. X      else
  414. X           ny = (ny / 2) - 1;
  415. X      if (ny < 0)
  416. X           ny = 0;
  417. X      if (dir == LeftGadgetGravity) {
  418. X           nx = lx + gdec->offset;
  419. X           if (lx != 0) /* not first time through, add pad */
  420. X            nx += GadgetPad;
  421. X           if (nx < 0)
  422. X            nx = 0;
  423. X           lx = nx + gdec->wide;
  424. X               dir = RightGadgetGravity;
  425. X      }
  426. X      else if (dir == RightGadgetGravity) {    
  427. X           nx = rx - gdec->wide - gdec->offset - (2 * GadgetBorder);
  428. X           if (rx != xwa.width)
  429. X            nx -= GadgetPad;
  430. X           rx = nx - GadgetBorder;
  431. X               dir = LeftGadgetGravity;
  432. X      }
  433. X      else /* Center Gravity */
  434. X           nx = ((xwa.width - gdec->wide) / 2) + gdec->offset;
  435. X      if (change == FALSE || !awi->gadgets[i]) {
  436. X           swa.background_pixel = GetPixel(gdec->backcolor, cmap);
  437. X           tmp = awi->gadgets[i] = XCreateWindow(dpy, awi->title, nx, ny,
  438. X                             gdec->wide, gdec->high,
  439. X                             GadgetBorder,
  440. X                             xwa.depth, xwa.class,
  441. X                             xwa.visual, valuemask,
  442. X                             &swa);
  443. X           if (!tmp) {
  444. X            fprintf(stderr, "PutGadgets: Can't create gadget #%d\n",
  445. X                i);
  446. X            Leave_void
  447. X           }
  448. X           if (gdec->data) {
  449. X            Pixmap pix;
  450. X
  451. X            pix = XCreatePixmapFromBitmapData(dpy, tmp, gdec->data,
  452. X                              gdec->wide, gdec->high,
  453. X                              GetPixel(gdec->forecolor, cmap),
  454. X                              GetPixel(gdec->backcolor, cmap),
  455. X                              xwa.depth);
  456. X            if (!pix) {
  457. X             fprintf(stderr, "PutGadgets: Unable to create pixmap for #%d\n",
  458. X                 i);
  459. X                         fprintf(stderr, "Using grey...\n");
  460. X#ifndef RAINBOW
  461. X                         pix = GrayPixmap;
  462. X#else
  463. X                         pix = awi->grayPixmap;
  464. X#endif
  465. X            }
  466. X            XSetWindowBackgroundPixmap(dpy, tmp, pix);
  467. X            XFreePixmap(dpy, pix);
  468. X           }
  469. X           XMapWindow(dpy, tmp);
  470. X           XSaveContext(dpy, tmp, AwmContext, (caddr_t) awi);
  471. X      }
  472. X      else
  473. X           XMoveWindow(dpy, awi->gadgets[i], nx, ny);
  474. X     }
  475. X     if (change == FALSE) /* make sure the window array is null terminated */
  476. X          awi->gadgets[i] = (Window)NULL;
  477. X     PaintGadgets(w);
  478. X     Leave_void
  479. X}
  480. X
  481. Xint FreeGadget(n)
  482. Xint n;
  483. X{
  484. X     Entry("FreeGadget")
  485. X
  486. X     if (Gadgets[n]->data)
  487. X      XFree(Gadgets[n]->data);
  488. X     if (Gadgets[n]->name)
  489. X      free(Gadgets[n]->name);
  490. X     if (Gadgets[n])
  491. X      free(Gadgets[n]);
  492. X}
  493. X
  494. Xint CheckGadgets()
  495. X{
  496. X     int i, status = 0;
  497. X
  498. X     Entry("CheckGadgets")
  499. X
  500. X     for (i = 0; i < NumGadgets; i++)
  501. X      if (!Gadgets[i]) {
  502. X           fprintf(stderr, "awm: Gadget #%d is not declared!\n",
  503. X               i);
  504. X           fprintf(stderr, "All gadgets from 0 to %d must be declared.\n",
  505. X               NumGadgets - 1);
  506. X           status = 1;
  507. X      }
  508. X     Leave(status)
  509. X}
  510. X
  511. XBoolean ResetGadgets()
  512. X{
  513. X     int i;
  514. X
  515. X     Entry("ResetGadgets")
  516. X
  517. X     for (i = 0; i < NumGadgets; i++) {
  518. X      FreeGadget(i);
  519. X      Gadgets[i] = 0;
  520. X     }
  521. X     NumGadgets = 0;
  522. X     if (Gadgets) {
  523. X      free(Gadgets);
  524. X      Gadgets = 0;
  525. X     }
  526. X}
  527. X     
  528. Xvoid DestroyGadgets(w)
  529. XWindow w;
  530. X{
  531. X     int i;
  532. X     AwmInfoPtr awi;
  533. X
  534. X     Entry("DestroyGadgets")
  535. X
  536. X     if (!(awi = IsTitled(w)))
  537. X      Leave_void
  538. X     if (!awi->gadgets)
  539. X      Leave_void
  540. X     for (i = 0; i < NumGadgets && Gadgets[i]; i++) {
  541. X      XDeleteContext(dpy, awi->gadgets[i], AwmContext);
  542. X      XDestroyWindow(dpy, awi->gadgets[i]);
  543. X     }
  544. X     free(awi->gadgets);
  545. X     awi->gadgets = 0;
  546. X     Leave_void
  547. X}
  548. X
  549. Xvoid PaintGadgets(w)
  550. XWindow w;
  551. X{
  552. X     int i, y, x = 0;
  553. X     AwmInfoPtr awi;
  554. X     GadgetDecl *gdec;
  555. X     XWindowAttributes xwa;
  556. X
  557. X     Entry("PaintGadgets")
  558. X
  559. X     if (!(awi = IsTitled(w)))
  560. X      Leave_void
  561. X     if (!awi->gadgets)
  562. X      Leave_void
  563. X     XGetWindowAttributes(dpy, awi->client, &xwa);
  564. X     for (i = 0; i < NumGadgets && Gadgets[i]; i++) {
  565. X      gdec = Gadgets[i];
  566. X      if (!gdec->data) {
  567. X           XGCValues gcv;
  568. X
  569. X           gcv.font = gdec->fontInfo->fid;
  570. X           gcv.foreground = GetPixel(gdec->forecolor, xwa.colormap);
  571. X           gcv.background = GetPixel(gdec->backcolor, xwa.colormap);
  572. X           XChangeGC(dpy, awi->winGC, (GCFont | GCForeground |
  573. X                       GCBackground), &gcv);
  574. X           if (strlen(gdec->name) == 1) { /* it's a glyph (we think) */
  575. X            XFontStruct *real_font;
  576. X            XCharStruct char_info;
  577. X            int char_number, index, byte1, byte2;
  578. X
  579. X            real_font = gdec->fontInfo;
  580. X            char_number = gdec->name[0];
  581. X            char_info = real_font->max_bounds;
  582. X            index = char_number;
  583. X
  584. X            if (real_font->per_char) {
  585. X             if (!real_font->min_byte1 && !real_font->max_byte1) {
  586. X                  if (char_number < real_font->min_char_or_byte2 ||
  587. X                  char_number > real_font->max_char_or_byte2)
  588. X                   index = real_font->default_char;
  589. X                  index -= real_font->min_char_or_byte2;
  590. X             } else {
  591. X                  byte2 = index & 0xff;
  592. X                  byte1 = (index>>8) & 0xff;
  593. X                  if (byte1 < real_font->min_byte1 ||
  594. X                  byte1 > real_font->max_byte1 ||
  595. X                  byte2 < real_font->min_char_or_byte2 ||
  596. X                  byte2 > real_font->max_char_or_byte2) {
  597. X                   byte2 = real_font->default_char & 0xff;
  598. X                   byte1 = (real_font->default_char>>8)&0xff;
  599. X                  }
  600. X                  byte1 -= real_font->min_byte1;
  601. X                  byte2 -= real_font->min_char_or_byte2;
  602. X                  index = byte1 * (real_font->max_char_or_byte2 -
  603. X                           real_font->min_char_or_byte2 + 1) +
  604. X                            byte2;
  605. X             }
  606. X             char_info = real_font->per_char[index];
  607. X            }
  608. X            x = 1 - GadgetBorder - char_info.lbearing;
  609. X            y = char_info.ascent;
  610. X           }
  611. X           else {
  612. X            y = (gdec->high + (gdec->fontInfo->max_bounds.ascent -
  613. X                       gdec->fontInfo->max_bounds.descent)) / 2;
  614. X            x = GadgetBorder;
  615. X           }
  616. X           XDrawString(dpy, awi->gadgets[i], awi->winGC, x,
  617. X               y, (char *) gdec->name, strlen(gdec->name));
  618. X      }
  619. X     }
  620. X     Leave_void
  621. X}
  622. END_OF_FILE
  623. if test 9031 -ne `wc -c <'Gadget.c'`; then
  624.     echo shar: \"'Gadget.c'\" unpacked with wrong size!
  625. fi
  626. # end of 'Gadget.c'
  627. fi
  628. if test -f 'GridBox.c' -a "${1}" != "-c" ; then 
  629.   echo shar: Will not clobber existing file \"'GridBox.c'\"
  630. else
  631. echo shar: Extracting \"'GridBox.c'\" \(7884 characters\)
  632. sed "s/^X//" >'GridBox.c' <<'END_OF_FILE'
  633. X
  634. X
  635. X
  636. X#ifndef lint
  637. Xstatic char *rcsid_StoreGridBox_c = "$Header: /usr/graph2/X11.3/contrib/windowmgrs/awm/RCS/GridBox.c,v 1.1 89/01/23 15:34:22 jkh Exp $";
  638. X#endif    lint
  639. X
  640. X#include "X11/copyright.h"
  641. X/*
  642. X *
  643. X * Copyright 1987, 1988 by Ardent Computer Corporation, Sunnyvale, Ca.
  644. X *
  645. X * Copyright 1987 by Jordan Hubbard.
  646. X *
  647. X *
  648. X *                         All Rights Reserved
  649. X *
  650. X * Permission to use, copy, modify, and distribute this software and its
  651. X * documentation for any purpose and without fee is hereby granted,
  652. X * provided that the above copyright notice appear in all copies and that
  653. X * both that copyright notice and this permission notice appear in
  654. X * supporting documentation, and that the name of Ardent Computer
  655. X * Corporation or Jordan Hubbard not be used in advertising or publicity
  656. X * pertaining to distribution of the software without specific, written
  657. X * prior permission.
  658. X *
  659. X */
  660. X
  661. X/*
  662. X * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
  663. X *
  664. X *                         All Rights Reserved
  665. X *
  666. X * Permission to use, copy, modify, and distribute this software and its
  667. X * documentation for any purpose and without fee is hereby granted,
  668. X * provided that the above copyright notice appear in all copies and that
  669. X * both that copyright notice and this permission notice appear in
  670. X * supporting documentation, and that the name of Digital Equipment
  671. X * Corporation not be used in advertising or publicity pertaining to
  672. X * distribution of the software without specific, written prior permission.
  673. X *
  674. X *
  675. X * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  676. X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  677. X * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  678. X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  679. X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  680. X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  681. X * SOFTWARE.
  682. X */
  683. X
  684. X
  685. X
  686. X/*
  687. X * MODIFICATION HISTORY
  688. X *
  689. X * 000 -- M. Gancarz, DEC Ultrix Engineering Group
  690. X * 001 -- Loretta Guarino Reid, DEC Ultrix Engineering Group,
  691. X *  Western Software Lab. Converted to X11.
  692. X * 002 -- Jordan Hubbard, Ardent Computer.
  693. X *  Changes for titled windows.
  694. X */
  695. X
  696. X#ifndef lint
  697. Xstatic char *sccsid = "@(#)StoreGridBox.c    3.8    1/24/86";
  698. X#endif
  699. X
  700. X/*
  701. X *    StoreGridBox - This subroutine is used by the X Window Manager (xwm)
  702. X *    to store the vertices for the movement resize grid and box in a
  703. X *    vertex list.
  704. X */
  705. X
  706. X#include "awm.h"
  707. X
  708. X/*
  709. X * Store the vertices for the movement resize grid and box in a vertex list.
  710. X */
  711. Xint StoreGridBox(box, ulx, uly, lrx, lry)
  712. Xregister XSegment box[];
  713. Xint ulx;            /* Upper left X coordinate. */
  714. Xint uly;            /* Upper left Y coordinate. */
  715. Xint lrx;            /* Lower right X coordinate. */
  716. Xint lry;            /* Lower right Y coordinate. */
  717. X{
  718. X    register int xthird, ythird;
  719. X    int x1third, y1third;
  720. X    int x2third, y2third;
  721. X
  722. X    Entry("StoreGridBox")
  723. X
  724. X    /*
  725. X     * Xor in.
  726. X     */
  727. X    box[0].x1 = ulx; box[0].y1 = uly;
  728. X    box[0].x2 = lrx; box[0].y2 = uly;
  729. X
  730. X    box[1].x1 = lrx; box[1].y1 = uly;
  731. X    box[1].x2 = lrx; box[1].y2 = lry;
  732. X
  733. X    box[2].x1 = lrx; box[2].y1 = lry;
  734. X    box[2].x2 = ulx; box[2].y2 = lry;
  735. X
  736. X    box[3].x1 = ulx; box[3].y1 = lry;
  737. X    box[3].x2 = ulx; box[3].y2 = uly;
  738. X
  739. X
  740. X    /*
  741. X     * These are the X and Y calculations for the parts of the grid that
  742. X     * are dependent on the division by 3 calculations.
  743. X     */
  744. X
  745. X    /*
  746. X     * Y dimension third.
  747. X     */
  748. X    ythird = (lry - uly) / 3;
  749. X    y1third = uly + ythird;
  750. X    y2third = y1third + ythird;
  751. X   
  752. X    /*
  753. X     * X dimension third.
  754. X     */
  755. X    xthird = (lrx - ulx) / 3;
  756. X    x1third = ulx + xthird;
  757. X    x2third = x1third + xthird;
  758. X
  759. X    box[4].x1 = x1third; box[4].y1 = lry;
  760. X    box[4].x2 = x1third; box[4].y2 = uly;
  761. X
  762. X    box[5].x1 = x2third; box[5].y1 = lry;
  763. X    box[5].x2 = x2third; box[5].y2 = uly;
  764. X
  765. X    box[6].x1 = ulx; box[6].y1 = y1third;
  766. X    box[6].x2 = lrx; box[6].y2 = y1third;
  767. X
  768. X    box[7].x1 = ulx; box[7].y1 = y2third;
  769. X    box[7].x2 = lrx; box[7].y2 = y2third;
  770. X
  771. X    /*
  772. X     * Do not erase if we're freezing the screen.
  773. X     */
  774. X    if (Freeze)
  775. X        Leave(8)
  776. X
  777. X    /*
  778. X     * From here on we're retracing the segments to clear the
  779. X     * grid using GXxor.
  780. X     */
  781. X    box[8].x1 = ulx; box[8].y1 = uly;
  782. X    box[8].x2 = lrx; box[8].y2 = uly;
  783. X
  784. X    box[9].x1 = lrx; box[9].y1 = uly;
  785. X    box[9].x2 = lrx; box[9].y2 = lry;
  786. X
  787. X    box[10].x1 = lrx; box[10].y1 = lry;
  788. X    box[10].x2 = ulx; box[10].y2 = lry;
  789. X
  790. X    box[11].x1 = ulx; box[11].y1 = lry;
  791. X    box[11].x2 = ulx; box[11].y2 = uly;
  792. X
  793. X    box[12].x1 = x1third; box[12].y1 = lry;
  794. X    box[12].x2 = x1third; box[12].y2 = uly;
  795. X
  796. X    box[13].x1 = x2third; box[13].y1 = lry;
  797. X    box[13].x2 = x2third; box[13].y2 = uly;
  798. X
  799. X    box[14].x1 = ulx; box[14].y1 = y1third;
  800. X    box[14].x2 = lrx; box[14].y2 = y1third;
  801. X
  802. X    box[15].x1 = ulx; box[15].y1 = y2third;
  803. X    box[15].x2 = lrx; box[15].y2 = y2third;
  804. X
  805. X
  806. X    /*
  807. X     * Total number of segments is 16.
  808. X     */
  809. X    Leave(16)
  810. X}
  811. X
  812. X/*
  813. X * Store the vertices for the movement resize grid and box in a vertex list.
  814. X * This is just like the routine above, but it adds a line for titled windows.
  815. X */
  816. X
  817. Xint StoreTitleGridBox(box, ulx, uly, lrx, lry)
  818. Xregister XSegment box[];
  819. Xint ulx;            /* Upper left X coordinate. */
  820. Xint uly;            /* Upper left Y coordinate. */
  821. Xint lrx;            /* Lower right X coordinate. */
  822. Xint lry;            /* Lower right Y coordinate. */
  823. X{
  824. X    register int xthird, ythird;
  825. X    int x1third, y1third;
  826. X    int x2third, y2third;
  827. X
  828. X    Entry("StoreTitleGridBox")
  829. X
  830. X    /*
  831. X     * Xor in.
  832. X     */
  833. X    box[0].x1 = ulx; box[0].y1 = uly;
  834. X    box[0].x2 = lrx; box[0].y2 = uly;
  835. X
  836. X    box[1].x1 = ulx; box[1].y1 = uly + titleHeight + 2;
  837. X    box[1].x2 = lrx; box[1].y2 = uly + titleHeight + 2;
  838. X
  839. X    box[2].x1 = lrx; box[2].y1 = uly;
  840. X    box[2].x2 = lrx; box[2].y2 = lry;
  841. X
  842. X    box[3].x1 = lrx; box[3].y1 = lry;
  843. X    box[3].x2 = ulx; box[3].y2 = lry;
  844. X
  845. X    box[4].x1 = ulx; box[4].y1 = lry;
  846. X    box[4].x2 = ulx; box[4].y2 = uly;
  847. X
  848. X
  849. X    /*
  850. X     * These are the X and Y calculations for the parts of the grid that
  851. X     * are dependent on the division by 3 calculations.
  852. X     */
  853. X
  854. X    /*
  855. X     * Y dimension third.
  856. X     */
  857. X    ythird = (lry - uly - titleHeight - 2) / 3;
  858. X    y1third = uly + ythird + titleHeight + 2;
  859. X    y2third = y1third + ythird;
  860. X   
  861. X    /*
  862. X     * X dimension third.
  863. X     */
  864. X    xthird = (lrx - ulx) / 3;
  865. X    x1third = ulx + xthird;
  866. X    x2third = x1third + xthird;
  867. X
  868. X    box[5].x1 = x1third; box[5].y1 = lry;
  869. X    box[5].x2 = x1third; box[5].y2 = uly + titleHeight + 3;
  870. X
  871. X    box[6].x1 = x2third; box[6].y1 = lry;
  872. X    box[6].x2 = x2third; box[6].y2 = uly + titleHeight + 3;
  873. X
  874. X    box[7].x1 = ulx; box[7].y1 = y1third;
  875. X    box[7].x2 = lrx; box[7].y2 = y1third;
  876. X
  877. X    box[8].x1 = ulx; box[8].y1 = y2third;
  878. X    box[8].x2 = lrx; box[8].y2 = y2third;
  879. X
  880. X    /*
  881. X     * Do not erase if we're freezing the screen.
  882. X     */
  883. X    if (Freeze)
  884. X        Leave(9)
  885. X
  886. X    /*
  887. X     * From here on we're retracing the segments to clear the
  888. X     * grid using GXxor.
  889. X     */
  890. X    box[9].x1 = ulx; box[9].y1 = uly;
  891. X    box[9].x2 = lrx; box[9].y2 = uly;
  892. X
  893. X    box[10].x1 = ulx; box[10].y1 = uly + titleHeight + 2;
  894. X    box[10].x2 = lrx; box[10].y2 = uly + titleHeight + 2;
  895. X
  896. X    box[11].x1 = lrx; box[11].y1 = uly;
  897. X    box[11].x2 = lrx; box[11].y2 = lry;
  898. X
  899. X    box[12].x1 = lrx; box[12].y1 = lry;
  900. X    box[12].x2 = ulx; box[12].y2 = lry;
  901. X
  902. X    box[13].x1 = ulx; box[13].y1 = lry;
  903. X    box[13].x2 = ulx; box[13].y2 = uly;
  904. X
  905. X    box[14].x1 = x1third; box[14].y1 = lry;
  906. X    box[14].x2 = x1third; box[14].y2 = uly + titleHeight + 3;
  907. X
  908. X    box[15].x1 = x2third; box[15].y1 = lry;
  909. X    box[15].x2 = x2third; box[15].y2 = uly + titleHeight + 3;
  910. X
  911. X    box[16].x1 = ulx; box[16].y1 = y1third;
  912. X    box[16].x2 = lrx; box[16].y2 = y1third;
  913. X
  914. X    box[17].x1 = ulx; box[17].y1 = y2third;
  915. X    box[17].x2 = lrx; box[17].y2 = y2third;
  916. X
  917. X
  918. X    /*
  919. X     * Total number of segments is 18.
  920. X     */
  921. X    Leave(18)
  922. X}
  923. END_OF_FILE
  924. if test 7884 -ne `wc -c <'GridBox.c'`; then
  925.     echo shar: \"'GridBox.c'\" unpacked with wrong size!
  926. fi
  927. # end of 'GridBox.c'
  928. fi
  929. if test -f 'Makefile' -a "${1}" != "-c" ; then 
  930.   echo shar: Will not clobber existing file \"'Makefile'\"
  931. else
  932. echo shar: Extracting \"'Makefile'\" \(9394 characters\)
  933. sed "s/^X//" >'Makefile' <<'END_OF_FILE'
  934. X# Makefile generated by imake - do not edit!
  935. X# $XConsortium: imake.c,v 1.37 88/10/08 20:08:30 jim Exp $
  936. X#
  937. X# The cpp used on this machine replaces all newlines and multiple tabs and
  938. X# spaces in a macro expansion with a single space.  Imake tries to compensate
  939. X# for this, but is not always successful.
  940. X#
  941. X
  942. X###########################################################################
  943. X# X Window System Makefile generated from template file Imake.tmpl
  944. X# $XConsortium: Imake.tmpl,v 1.91 88/10/23 22:37:10 jim Exp $
  945. X#
  946. X# Do not change the body of the imake template file.  Server-specific
  947. X# parameters may be set in the appropriate .macros file; site-specific
  948. X# parameters (but shared by all servers) may be set in site.def.  If you
  949. X# make any changes, you'll need to rebuild the makefiles using
  950. X# "make World" (at best) or "make Makefile; make Makefiles" (at least) in
  951. X# the top level directory.
  952. X#
  953. X# If your C preprocessor doesn't define any unique symbols, you'll need
  954. X# to set BOOTSTRAPCFLAGS when rebuilding imake (usually when doing
  955. X# "make Makefile", "make Makefiles", or "make World").
  956. X#
  957. X# If you absolutely can't get imake to work, you'll need to set the
  958. X# variables at the top of each Makefile as well as the dependencies at the
  959. X# bottom (makedepend will do this automatically).
  960. X#
  961. X
  962. X###########################################################################
  963. X# platform-specific configuration parameters - edit Sun.macros to change
  964. X
  965. X# platform:  $XConsortium: Sun.macros,v 1.52 88/10/23 11:00:55 jim Exp $
  966. X# operating system:   SunOS 3.4
  967. X
  968. XBOOTSTRAPCFLAGS =
  969. X             AS = as
  970. X             CC = cc
  971. X            CPP = /lib/cpp
  972. X             LD = ld
  973. X           LINT = lint
  974. X        INSTALL = install
  975. X           TAGS = ctags
  976. X             RM = rm -f
  977. X             MV = mv
  978. X             LN = ln -s
  979. X         RANLIB = ranlib
  980. XRANLIBINSTFLAGS = -t
  981. X             AR = ar clq
  982. X             LS = ls
  983. X       LINTOPTS = -xz
  984. X    LINTLIBFLAG = -C
  985. X           MAKE = make
  986. XSTD_CPP_DEFINES =
  987. X    STD_DEFINES =
  988. X
  989. X###########################################################################
  990. X# site-specific configuration parameters - edit site.def to change
  991. X
  992. X# site:  $XConsortium: site.def,v 1.16 88/10/12 10:30:24 jim Exp $
  993. X
  994. X###########################################################################
  995. X# definitions common to all Makefiles - do not edit
  996. X
  997. X          SHELL =  /bin/sh
  998. X
  999. X        DESTDIR = /global
  1000. X      USRLIBDIR = $(DESTDIR)/lib
  1001. X         BINDIR = $(DESTDIR)/bin/X11
  1002. X         INCDIR = $(DESTDIR)/include
  1003. X         ADMDIR = $(DESTDIR)/usr/adm
  1004. X         LIBDIR = $(USRLIBDIR)/X11
  1005. X     LINTLIBDIR = $(USRLIBDIR)/lint
  1006. X        FONTDIR = $(LIBDIR)/fonts
  1007. X       XINITDIR = $(LIBDIR)/xinit
  1008. X         XDMDIR = $(LIBDIR)/xdm
  1009. X         UWMDIR = $(LIBDIR)/uwm
  1010. X         AWMDIR = $(LIBDIR)/awm
  1011. X         TWMDIR = $(LIBDIR)/twm
  1012. X          DTDIR = $(LIBDIR)/dt
  1013. X        MANPATH = /usr/man
  1014. X  MANSOURCEPATH = $(MANPATH)/man
  1015. X         MANDIR = $(MANSOURCEPATH)n
  1016. X      LIBMANDIR = $(MANSOURCEPATH)n3
  1017. X    XAPPLOADDIR = $(LIBDIR)/app-defaults
  1018. X
  1019. X   INSTBINFLAGS = -m 0755
  1020. X   INSTUIDFLAGS = -m 4755
  1021. X   INSTLIBFLAGS = -m 0664
  1022. X   INSTINCFLAGS = -m 0444
  1023. X   INSTMANFLAGS = -m 0444
  1024. X   INSTAPPFLAGS = -m 0444
  1025. X  INSTKMEMFLAGS = -m 4755
  1026. X        FCFLAGS = -t
  1027. X    CDEBUGFLAGS = -O
  1028. X
  1029. X        PATHSEP = /
  1030. X         DEPEND = $(BINDIR)/makedepend
  1031. X          IMAKE = $(BINDIR)/imake
  1032. X            RGB = $(LIBDIR)/rgb
  1033. X             FC = $(BINDIR)/bdftosnf
  1034. X      MKFONTDIR = $(BINDIR)/mkfontdir
  1035. X      MKDIRHIER = $(BINDIR)/mkdirhier.sh
  1036. X
  1037. X         CFLAGS = $(CDEBUGFLAGS) $(INCLUDES) $(STD_DEFINES) $(DEFINES)
  1038. X      LINTFLAGS = $(LINTOPTS) $(INCLUDES) $(STD_DEFINES) $(DEFINES) -DLINT
  1039. X        LDFLAGS = $(CDEBUGFLAGS) -L$(USRLIBDIR) $(SYS_LIBRARIES) $(SYSAUX_LIBRARIES)
  1040. X
  1041. X       IRULESRC = $(LIBDIR)/imake.includes
  1042. X
  1043. X   EXTENSIONLIB = $(USRLIBDIR)/libext.a
  1044. X           XLIB = $(USRLIBDIR)/libX11.a
  1045. X         XMULIB = $(USRLIBDIR)/libXmu.a
  1046. X        OLDXLIB = $(USRLIBDIR)/liboldX.a
  1047. X       XTOOLLIB = $(USRLIBDIR)/libXt.a
  1048. X         XAWLIB = $(USRLIBDIR)/libXaw.a
  1049. X       LINTXLIB = $(USRLIBDIR)/lint/llib-lX11.ln
  1050. X        LINTXMU = $(USRLIBDIR)/lint/llib-lXmu.ln
  1051. X      LINTXTOOL = $(USRLIBDIR)/lint/llib-lXt.ln
  1052. X        LINTXAW = $(USRLIBDIR)/lint/llib-lXaw.ln
  1053. X       INCLUDES = -I$(INCDIR)
  1054. X      MACROFILE = Sun.macros
  1055. X   ICONFIGFILES = $(IRULESRC)/Imake.tmpl \
  1056. X            $(IRULESRC)/$(MACROFILE) $(IRULESRC)/site.def
  1057. X  IMAKE_DEFINES =
  1058. X      IMAKE_CMD = $(NEWTOP)$(IMAKE) -TImake.tmpl -I$(NEWTOP)$(IRULESRC) \
  1059. X            -s Makefile $(IMAKE_DEFINES)
  1060. X         RM_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a \
  1061. X            .emacs_* tags TAGS make.log MakeOut
  1062. X
  1063. X###########################################################################
  1064. X# rules:  $XConsortium: Imake.rules,v 1.71 88/10/23 22:46:34 jim Exp $
  1065. X
  1066. X###########################################################################
  1067. X# start of Imakefile
  1068. X
  1069. X       MENU_LIB = menus
  1070. X      MENU_ARCH = $(MENU_LIB)/rtlmenu.a
  1071. X     NEATEN_LIB = /grgr/neaten
  1072. X    NEATEN_ARCH = $(NEATEN_LIB)/neaten.a
  1073. X  SYS_LIBRARIES = -ll -lm
  1074. X      OTHERSRCS = gram.y lex.l
  1075. X         YFLAGS = -d
  1076. X         HFILES = awm.h neaten.def.h neaten.ext.h support.h
  1077. X
  1078. X# The following defines can be added to the approprate DEFINES macro
  1079. X# (see below) to enable additional features.
  1080. X#
  1081. X# -DCONSOLE if you want output (stderr and stdout) to go to the system console.
  1082. X#
  1083. X# -DWMSTATE if you want the XA_WM_STATE atom to reflect the state of each
  1084. X#     top-level window (I.E. iconified, not iconified, etc).
  1085. X#
  1086. X# -DRAINBOW if you want to be able to specify border colors on a client or
  1087. X#     class basis.
  1088. X#
  1089. X# -DLOCKSCR if for some reason you want a lockscreen function built into
  1090. X#     the window manager. Could be just as easily done by invoking a program,
  1091. X#     but some like to put all their eggs in one basket.
  1092. X
  1093. X# Use these macros if you want the RTL Neaten package.
  1094. X# Also make sure that NEATEN_LIB points to the right place. See the README
  1095. X# file for instructions (though you can just define this and give it a shot).
  1096. X#       DEFINES = -DSYSFILE=\"$(AWMDIR)$(PATHSEP)system.awmrc\" -DNEATEN
  1097. X#       LOCAL_LIBRARIES = $(NEATEN_ARCH) $(MENU_ARCH) $(XMULIB) $(XLIB)
  1098. X
  1099. X# Use these macros if you don't want the RTL Neaten package.
  1100. X        DEFINES = -DSYSFILE=\"$(AWMDIR)$(PATHSEP)system.awmrc\" -DWMSTATE -DLOCKSCR
  1101. X        LOCAL_LIBRARIES = $(MENU_ARCH) $(XMULIB) $(XLIB)
  1102. X        LINTLIBS = $(LINTXLIB)
  1103. X
  1104. XSRCS=    globals.c Beep.c Bindings.c CircleDown.c CircleUp.c\
  1105. X    Cursors.c Focus.c GetButton.c  GridBox.c Iconify.c Icons.c Lower.c\
  1106. X    Menu.c Move.c MoveOpaque.c NewIconify.c Pause.c Push.c Error.c\
  1107. X    Raise.c Refresh.c Resize.c Restart.c RubberBand.c StoreBox.c \
  1108. X    StoreZap.c XError.c awm.c FocusChng.c Titlebar.c errHndlr.c \
  1109. X    Grab.c menu_sup.c Gadget.c support.c exp_path.c Neaten.c \
  1110. X    lockscreen.c Lock.c
  1111. X
  1112. XOBJS=    gram.o lex.o globals.o Beep.o Bindings.o CircleDown.o CircleUp.o\
  1113. X    Cursors.o Focus.o GetButton.o GridBox.o Iconify.o Icons.o Lower.o\
  1114. X    Menu.o Move.o MoveOpaque.o NewIconify.o Pause.o Push.o Error.o\
  1115. X    Raise.o Refresh.o Resize.o Restart.o RubberBand.o StoreBox.o \
  1116. X    StoreZap.o XError.o awm.o FocusChng.o Titlebar.o errHndlr.o \
  1117. X    Grab.o menu_sup.o Gadget.o support.o exp_path.o Neaten.o \
  1118. X    lockscreen.o Lock.o
  1119. X
  1120. X PROGRAM = awm
  1121. X
  1122. Xall:: awm
  1123. X
  1124. Xawm: $(OBJS) $(LOCAL_LIBRARIES)
  1125. X    $(RM) $@
  1126. X    $(CC) -o $@ $(OBJS) $(LOCAL_LIBRARIES) $(LDFLAGS) $(SYSLAST_LIBRARIES)
  1127. X
  1128. Xrelink::
  1129. X    $(RM) $(PROGRAM)
  1130. X    $(MAKE) $(MFLAGS) $(PROGRAM)
  1131. X
  1132. Xinstall:: awm
  1133. X    $(INSTALL) -c $(INSTALLFLAGS) awm $(BINDIR)
  1134. X
  1135. Xinstall.man:: awm.man
  1136. X    $(INSTALL) -c $(INSTMANFLAGS) awm.man $(MANDIR)/awm.n
  1137. X
  1138. Xdepend:: $(DEPEND)
  1139. X
  1140. Xdepend::
  1141. X    $(DEPEND) -s "# DO NOT DELETE" -- $(CFLAGS) -- $(SRCS)
  1142. X
  1143. X$(DEPEND):
  1144. X    @echo "making $@"; \
  1145. X    cd $(DEPENDSRC); $(MAKE)
  1146. X
  1147. Xclean::
  1148. X    $(RM) $(PROGRAM)
  1149. X
  1150. Xlint:
  1151. X    $(LINT) $(LINTFLAGS) $(SRCS) gram.c lex.c $(LINTLIBS)
  1152. Xlint1:
  1153. X    $(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS)
  1154. X
  1155. Xinstall:: system.awmrc
  1156. X    $(INSTALL) -c $(INSTALLFLAGS) system.awmrc  $(AWMDIR)
  1157. X
  1158. X$(MENU_ARCH)::
  1159. X    @echo Making menu package...
  1160. X    @(cd $(MENU_LIB); make CC=$(CC) CFLAGS="$(CFLAGS)")
  1161. X    @echo done.
  1162. X
  1163. X$(NEATEN_ARCH)::
  1164. X    cp Makefile.rtl $(NEATEN_LIB)/Makefile
  1165. X    @echo Making Neaten package
  1166. X    @(cd $(NEATEN_LIB); make -f Makefile)
  1167. X    @echo done.
  1168. X
  1169. Xclean::
  1170. X    @echo Cleaning menus...
  1171. X    @(cd $(MENU_LIB); make clean)
  1172. X    @echo done.
  1173. X    rm -f y.tab.h
  1174. X
  1175. Xnoident::
  1176. X    @echo Removing ident lines from awm...
  1177. X    @for i in $(SRCS) $(OTHERSRCS) $(HFILES); do \
  1178. X    sed -e '/#ident/D' < $$i > /tmp/x.$$i && \
  1179. X    mv /tmp/x.$$i $$i ; \
  1180. X    done
  1181. X    @(cd $(MENU_LIB); make noident)
  1182. X    @echo done.
  1183. X
  1184. X###########################################################################
  1185. X# Imake.tmpl common rules for all Makefiles - do not edit
  1186. X
  1187. Xemptyrule::
  1188. X
  1189. Xclean::
  1190. X    $(RM_CMD) \#*
  1191. X
  1192. XMakefile:: $(IMAKE)
  1193. X
  1194. XMakefile:: Imakefile \
  1195. X    $(IRULESRC)/Imake.tmpl \
  1196. X    $(IRULESRC)/Imake.rules \
  1197. X    $(IRULESRC)/site.def \
  1198. X    $(IRULESRC)/$(MACROFILE)
  1199. X    -@if [ -f Makefile ]; then \
  1200. X    echo "$(RM) Makefile.bak; $(MV) Makefile Makefile.bak"; \
  1201. X    $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \
  1202. X    else exit 0; fi
  1203. X    $(IMAKE_CMD) -DTOPDIR=$(TOP)
  1204. X
  1205. X$(IMAKE):
  1206. X    @echo "making $@"; \
  1207. X    cd $(IMAKESRC); $(MAKE) BOOTSTRAPCFLAGS=$(BOOTSTRAPCFLAGS)
  1208. X
  1209. Xtags::
  1210. X    $(TAGS) -w *.[ch]
  1211. X    $(TAGS) -xw *.[ch] > TAGS
  1212. X
  1213. X###########################################################################
  1214. X# empty rules for directories that do not have SUBDIRS - do not edit
  1215. X
  1216. Xinstall::
  1217. X    @echo "install done"
  1218. X
  1219. Xinstall.man::
  1220. X    @echo "install.man done"
  1221. X
  1222. XMakefiles::
  1223. X
  1224. X###########################################################################
  1225. X# dependencies generated by makedepend
  1226. X
  1227. END_OF_FILE
  1228. if test 9394 -ne `wc -c <'Makefile'`; then
  1229.     echo shar: \"'Makefile'\" unpacked with wrong size!
  1230. fi
  1231. # end of 'Makefile'
  1232. fi
  1233. if test -f 'Move.c' -a "${1}" != "-c" ; then 
  1234.   echo shar: Will not clobber existing file \"'Move.c'\"
  1235. else
  1236. echo shar: Extracting \"'Move.c'\" \(8666 characters\)
  1237. sed "s/^X//" >'Move.c' <<'END_OF_FILE'
  1238. X
  1239. X
  1240. X
  1241. X#ifndef lint
  1242. Xstatic char *rcsid_Move_c = "$Header: /usr/graph2/X11.3/contrib/windowmgrs/awm/RCS/Move.c,v 1.2 89/02/07 21:22:55 jkh Exp $";
  1243. X#endif    lint
  1244. X
  1245. X#include "X11/copyright.h"
  1246. X/*
  1247. X *
  1248. X * Copyright 1987, 1988 by Ardent Computer Corporation, Sunnyvale, Ca.
  1249. X *
  1250. X * Copyright 1987 by Jordan Hubbard.
  1251. X *
  1252. X *
  1253. X *                         All Rights Reserved
  1254. X *
  1255. X * Permission to use, copy, modify, and distribute this software and its
  1256. X * documentation for any purpose and without fee is hereby granted,
  1257. X * provided that the above copyright notice appear in all copies and that
  1258. X * both that copyright notice and this permission notice appear in
  1259. X * supporting documentation, and that the name of Ardent Computer
  1260. X * Corporation or Jordan Hubbard not be used in advertising or publicity
  1261. X * pertaining to distribution of the software without specific, written
  1262. X * prior permission.
  1263. X *
  1264. X */
  1265. X
  1266. X/*
  1267. X * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
  1268. X *
  1269. X *                         All Rights Reserved
  1270. X *
  1271. X * Permission to use, copy, modify, and distribute this software and its
  1272. X * documentation for any purpose and without fee is hereby granted,
  1273. X * provided that the above copyright notice appear in all copies and that
  1274. X * both that copyright notice and this permission notice appear in
  1275. X * supporting documentation, and that the name of Digital Equipment
  1276. X * Corporation not be used in advertising or publicity pertaining to
  1277. X * distribution of the software without specific, written prior permission.
  1278. X *
  1279. X *
  1280. X * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  1281. X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  1282. X * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  1283. X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  1284. X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  1285. X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  1286. X * SOFTWARE.
  1287. X */
  1288. X
  1289. X/*
  1290. X * MODIFICATION HISTORY
  1291. X *
  1292. X * 000 -- M. Gancarz, DEC Ultrix Engineering Group
  1293. X * 001 -- Loretta Guarino Reid, DEC Ultrix Engineering Group, 
  1294. X *      Western Software Lab. Port to X11
  1295. X */
  1296. X
  1297. X#include "awm.h"
  1298. X
  1299. X/*ARGSUSED*/
  1300. XBoolean Move(window, mask, button, x, y)
  1301. XWindow window;                /* Event window. */
  1302. Xint mask;                /* Button/key mask. */
  1303. Xint button;                /* Button event detail. */
  1304. Xint x, y;                /* Event mouse position. */
  1305. X{
  1306. X     register int prev_x;        /* Previous event window X location. */
  1307. X     register int prev_y;        /* Previous event window Y location. */
  1308. X     XWindowAttributes window_info;    /* Event window information. */
  1309. X     int cur_x;                /* Current event window X location. */
  1310. X     int cur_y;                /* Current event window Y location. */
  1311. X     int root_x;                /* Root window X location. */
  1312. X     int root_y;                /* Root window Y location. */
  1313. X     int ulx, uly;            /* Event window upper left X and Y. */
  1314. X     int lrx, lry;            /* Event window lower right X and Y. */
  1315. X     int init_ulx, init_uly;        /* Init window upper left X and Y. */
  1316. X     int init_lrx, init_lry;        /* Init window lower right X and Y. */
  1317. X     int num_vectors;            /* Number of vectors in box. */
  1318. X     unsigned int ptrmask;        /* state of ptr when queried */
  1319. X     Window sub_window;            /* Query mouse event sub-window. */
  1320. X     Window root;            /* Query mouse event root. */
  1321. X     AwmInfoPtr awi;
  1322. X     XEvent button_event;        /* Button event packet. */
  1323. X     XSegment box[MAX_BOX_VECTORS];    /* Box vertex buffer. */
  1324. X     XSegment zap[MAX_ZAP_VECTORS];    /* Zap effect verted buffer. */
  1325. X     int (*storegrid_func)();        /* Function to use for grid */
  1326. X     int (*storebox_func)();        /* Function to use for box */
  1327. X     extern void ungrab_pointer();
  1328. X     extern void grab_pointer();
  1329. X     
  1330. X     Entry("Move")
  1331. X      
  1332. X     /*
  1333. X      * Do not try to move the root window.
  1334. X      */
  1335. X     if (window == RootWindow(dpy, scr))
  1336. X      Leave(FALSE)
  1337. X            
  1338. X     /*
  1339. X      * Change the cursor.
  1340. X      */
  1341. X     grab_pointer();
  1342. X     /*
  1343. X      * Clear the vector buffers.
  1344. X      */
  1345. X     bzero(box, sizeof(box));
  1346. X     if (Zap)
  1347. X      bzero(zap, sizeof(zap));
  1348. X     
  1349. X     /*
  1350. X      * Gather info on the event window.
  1351. X      */
  1352. X     awi = GetAwmInfo(window);
  1353. X     if (!awi)
  1354. X      Leave(FALSE)
  1355. X     status = XGetWindowAttributes(dpy, window, &window_info);
  1356. X     if (status == FAILURE)
  1357. X      Leave(FALSE)
  1358. X
  1359. X     if (awi->title && !IsIcon(window, None)) {
  1360. X      storegrid_func = StoreTitleGridBox;
  1361. X      storebox_func = StoreTitleBox;
  1362. X     }
  1363. X     else {
  1364. X      storegrid_func = StoreGridBox;
  1365. X      storebox_func = StoreBox;
  1366. X     }
  1367. X     /*
  1368. X      * Initialize movement variables.
  1369. X      */
  1370. X     init_ulx = ulx = window_info.x;
  1371. X     init_uly = uly = window_info.y;
  1372. X     init_lrx = lrx = window_info.x + window_info.width +
  1373. X      (window_info.border_width << 1) - 1;
  1374. X     init_lry = lry = window_info.y + window_info.height +
  1375. X      (window_info.border_width << 1) - 1;
  1376. X     
  1377. X     /*
  1378. X      * Store the box.
  1379. X      */
  1380. X     if (Grid)
  1381. X      num_vectors = (*storegrid_func)(box, ulx, uly, lrx, lry);
  1382. X     else
  1383. X      num_vectors = (*storebox_func)(box, ulx, uly, lrx, lry);
  1384. X     
  1385. X     /*
  1386. X      * Initialize the previous location variables.
  1387. X      */
  1388. X     prev_x = x;
  1389. X     prev_y = y;
  1390. X     
  1391. X     /*
  1392. X      * Freeze the server, if requested by the user.
  1393. X      * This results in a solid box instead of a flickering one.
  1394. X      */
  1395. X     if (Freeze)
  1396. X      XGrabServer(dpy);
  1397. X     Snatched = True;
  1398. X     /*
  1399. X      * Process any pending exposure events before drawing the box.
  1400. X      */
  1401. X     while (QLength(dpy) > 0) {
  1402. X      XPeekEvent(dpy, &button_event);
  1403. X      if (((XAnyEvent *)&button_event)->window == RootWindow(dpy, scr))
  1404. X           break;
  1405. X      GetButton(&button_event);
  1406. X     }
  1407. X     
  1408. X     /*
  1409. X      * Now draw the box.
  1410. X      */
  1411. X     
  1412. X     DrawBox();
  1413. X     Frozen = window;
  1414. X     
  1415. X     /*
  1416. X      * Main loop.
  1417. X      */
  1418. X     while (TRUE) {
  1419. X      
  1420. X      /*
  1421. X       * Check to see if we have a change in mouse button status.
  1422. X       * This is how we get out of this "while" loop.
  1423. X       */
  1424. X      if (XPending(dpy) && !ProcessRequests(box, num_vectors) &&
  1425. X          GetButton(&button_event)) {
  1426. X           /*
  1427. X        * Process the pending events, this sequence is the only
  1428. X        * way out of the loop and the routine.
  1429. X        */
  1430. X           
  1431. X           if ((button_event.type != ButtonPress) && 
  1432. X           (button_event.type != ButtonRelease)) {
  1433. X            continue; /* spurious menu event... */
  1434. X           }
  1435. X           
  1436. X           /*
  1437. X        * If we froze the server, then erase the last lines drawn.
  1438. X        */
  1439. X           if (Freeze) {
  1440. X            DrawBox();
  1441. X            Frozen = (Window)0;
  1442. X            XUngrabServer(dpy);
  1443. X           }
  1444. X           
  1445. X           if ((button_event.type == ButtonRelease) &&
  1446. X           (((XButtonReleasedEvent *)&button_event)->button == button)) {
  1447. X            
  1448. X            /*
  1449. X             * The button was released, so move the window.
  1450. X             */
  1451. X            
  1452. X            if (Zap) {
  1453. X             num_vectors = StoreZap(zap,
  1454. X                        init_ulx, init_uly,
  1455. X                        init_lrx, init_lry,
  1456. X                        ulx, uly,
  1457. X                        lrx, lry);
  1458. X             DrawZap();
  1459. X             DrawZap();
  1460. X            }
  1461. X#ifdef titan /* 5x4 alignment */
  1462. X            ulx = ((ulx + 3) / 5) * 5;
  1463. X            uly = ((uly + 2) / 4) * 4;
  1464. X#endif /* titan */
  1465. X            if (Wall) {
  1466. X             if (ulx < 0)
  1467. X                  ulx = 0;
  1468. X             if (ulx > (ScreenWidth - window_info.width))
  1469. X                  ulx = (ScreenWidth - window_info.width);
  1470. X             if (uly < 0)
  1471. X                  uly = 0;
  1472. X             if (uly > (ScreenHeight - window_info.height))
  1473. X                  uly = (ScreenHeight - window_info.height);
  1474. X            }
  1475. X            XMoveWindow(dpy, window, ulx, uly);
  1476. X            Snatched = False;
  1477. X            ungrab_pointer();
  1478. X            Leave(TRUE)
  1479. X           }
  1480. X           else {
  1481. X            /*
  1482. X             * Some other button event occured, this aborts the
  1483. X             * current operation.
  1484. X             */
  1485. X            
  1486. X            ResetCursor(button);
  1487. X            Snatched = False;
  1488. X            ungrab_pointer();
  1489. X            Leave(TRUE)
  1490. X           }
  1491. X      }
  1492. X      
  1493. X      /*
  1494. X       * Take care of all the little things that have changed.
  1495. X       */
  1496. X      XQueryPointer(dpy, 
  1497. X            RootWindow(dpy, scr), &root,  &sub_window,
  1498. X            &root_x, &root_y, &cur_x, &cur_y, &ptrmask);
  1499. X      if ((cur_x != prev_x) || (cur_y != prev_y)) {
  1500. X           
  1501. X           /*
  1502. X        * If we've frozen the server, then erase the old box first!
  1503. X        */
  1504. X           if (Freeze)
  1505. X            DrawBox();
  1506. X           
  1507. X           /*
  1508. X        * Box position has changed.
  1509. X        */
  1510. X           ulx += cur_x - prev_x;
  1511. X           uly += cur_y - prev_y;
  1512. X           lrx += cur_x - prev_x;
  1513. X           lry += cur_y - prev_y;
  1514. X           
  1515. X           /*
  1516. X        * Box needs to be restored.
  1517. X        */
  1518. X           if (Grid)
  1519. X            num_vectors = (*storegrid_func)(box, ulx, uly, lrx, lry);
  1520. X           else
  1521. X            num_vectors = (*storebox_func)(box, ulx, uly, lrx, lry);
  1522. X           
  1523. X           
  1524. X           /*
  1525. X        * Draw the new box.
  1526. X        */
  1527. X           if (Freeze)
  1528. X            DrawBox();
  1529. X      }
  1530. X      
  1531. X      /* 
  1532. X       * Save old box position.
  1533. X       */
  1534. X      prev_x = cur_x;
  1535. X      prev_y = cur_y;
  1536. X      
  1537. X      /*
  1538. X       * If server is not frozen, then draw the "flicker" box.
  1539. X       */
  1540. X      if (!Freeze) {
  1541. X           DrawBox();
  1542. X           DrawBox();
  1543. X      }
  1544. X     }
  1545. X}
  1546. END_OF_FILE
  1547. if test 8666 -ne `wc -c <'Move.c'`; then
  1548.     echo shar: \"'Move.c'\" unpacked with wrong size!
  1549. fi
  1550. # end of 'Move.c'
  1551. fi
  1552. if test -f 'bitmaps/titlehilite.bm' -a "${1}" != "-c" ; then 
  1553.   echo shar: Will not clobber existing file \"'bitmaps/titlehilite.bm'\"
  1554. else
  1555. echo shar: Extracting \"'bitmaps/titlehilite.bm'\" \(290 characters\)
  1556. sed "s/^X//" >'bitmaps/titlehilite.bm' <<'END_OF_FILE'
  1557. X#define titlebold_width 16
  1558. X#define titlebold_height 16
  1559. Xstatic char titlebold_bits[] = {
  1560. X   0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00,
  1561. X   0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00,
  1562. X   0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00};
  1563. END_OF_FILE
  1564. if test 290 -ne `wc -c <'bitmaps/titlehilite.bm'`; then
  1565.     echo shar: \"'bitmaps/titlehilite.bm'\" unpacked with wrong size!
  1566. fi
  1567. # end of 'bitmaps/titlehilite.bm'
  1568. fi
  1569. if test -f 'menus/menu.def.h' -a "${1}" != "-c" ; then 
  1570.   echo shar: Will not clobber existing file \"'menus/menu.def.h'\"
  1571. else
  1572. echo shar: Extracting \"'menus/menu.def.h'\" \(6570 characters\)
  1573. sed "s/^X//" >'menus/menu.def.h' <<'END_OF_FILE'
  1574. X
  1575. X/*
  1576. X#ifndef lint
  1577. Xstatic char sccs_id[] = "@(#)menu.define.h    2.1 12/16/87  Siemens Corporate Research and Support, Inc.";
  1578. X#endif
  1579. X*/
  1580. X
  1581. X
  1582. X/*
  1583. X  RTL Menu Package Version 1.0
  1584. X  by Joe Camaratta and Mike Berman, Siemens RTL, Princeton NJ, 1987
  1585. X
  1586. X  menu.h: macros for menu package
  1587. X
  1588. X#include "X11/copyright.h"
  1589. X/*
  1590. X *
  1591. X * Copyright 1987, 1988 by Ardent Computer Corporation, Sunnyvale, Ca.
  1592. X *
  1593. X * Copyright 1987 by Jordan Hubbard.
  1594. X *
  1595. X *
  1596. X *                         All Rights Reserved
  1597. X *
  1598. X * Permission to use, copy, modify, and distribute this software and its
  1599. X * documentation for any purpose and without fee is hereby granted,
  1600. X * provided that the above copyright notice appear in all copies and that
  1601. X * both that copyright notice and this permission notice appear in
  1602. X * supporting documentation, and that the name of Ardent Computer
  1603. X * Corporation or Jordan Hubbard not be used in advertising or publicity
  1604. X * pertaining to distribution of the software without specific, written
  1605. X * prior permission.
  1606. X *
  1607. X */
  1608. X
  1609. X/*
  1610. X
  1611. XCopyright 1987 by
  1612. X    Siemens Corporate Research and Support, Inc., Princeton, New Jersey
  1613. X
  1614. XPermission to use, copy, modify, and distribute this software
  1615. Xand its documentation for any purpose and without fee is
  1616. Xhereby granted, provided that the above copyright notice
  1617. Xappear in all copies and that both that copyright notice and
  1618. Xthis permission notice appear in supporting documentation, and
  1619. Xthat the name of Siemens not be used in advertising or
  1620. Xpublicity pertaining to distribution of the software without
  1621. Xspecific, written prior permission.  Siemens makes no
  1622. Xrepresentations about the suitability of this software for any
  1623. Xpurpose.  It is provided "as is" without express or implied
  1624. Xwarranty.
  1625. X
  1626. X*/
  1627. X#ifndef MENU_DEF_INCLUDE
  1628. X#define MENU_DEF_INCLUDE
  1629. X
  1630. X/* Menu data structure access macros */
  1631. X
  1632. X#define MenuWidth(menu) (menu)->menuWidth
  1633. X#define MenuHeight(menu) (menu)->menuHeight
  1634. X#define MenuOldWidth(menu) (menu)->menuOldWidth
  1635. X#define MenuOldHeight(menu) (menu)->menuOldHeight
  1636. X#define MenuItemWidth(menu) (menu)->menuItemWidth
  1637. X#define MenuFlags(menu) (menu)->menuFlags
  1638. X#define MenuMaxTextWidth(menu) (menu)->menuMaxTextWidth
  1639. X#define MenuBorderWidth(menu) MBorderWidth
  1640. X#define MenuOldBorderWidth(menu) (menu)->menuOldBorderWidth
  1641. X#define MenuItemPad(menu) MPad
  1642. X#define MenuDisplay(menu) (menu)->display
  1643. X#define MenuScreen(menu) (menu)->screen
  1644. X#define MenuWindow(menu) (menu)->menuWindow
  1645. X#define MenuCursor(menu) (menu)->menuCursor
  1646. X#define MenuSavedPixmap(menu) (menu)->savedPixmap
  1647. X#define MenuSavedImage(menu) ((menu)->savedImage)
  1648. X#define MenuSavedImageX(menu) (menu)->menuSavedImageX
  1649. X#define MenuSavedImageY(menu) (menu)->menuSavedImageY
  1650. X#define MenuItems(menu) (menu)->menuItems
  1651. X#define MenuFontInfo(menu) (menu)->menuFontInfo
  1652. X#define MenuNormalGC(menu) (menu)->normalGC
  1653. X#define MenuInvertGC(menu) (menu)->invertGC
  1654. X#define MenuGreyGC(menu) (menu)->greyGC
  1655. X#define MenuGreyPixmap(menu) (menu)->greyPixmap
  1656. X#define MenuCheckmarkPixmap(menu) (menu)->checkmarkPixmap
  1657. X#define MenuArrowPixmap(menu) (menu)->arrowPixmap
  1658. X#define MenuInitialItemText(menu) (menu)->menuInitialItemText
  1659. X#define MenuItemHighlighted(menu) (menu)->highlightedItem
  1660. X#define MenuNested(menu) (menu)->menuNested
  1661. X#define MenuX(menu) (menu)->menuX
  1662. X#define MenuY(menu) (menu)->menuY
  1663. X#define MenuParent(menu) (menu)->parentMenu
  1664. X#define MenuDelta(menu) MDelta
  1665. X#define MenuOptions(menu) (menu)->menuOptions
  1666. X#define NULLMENU ((Menu *) NULL)
  1667. X
  1668. X/* Menu predicates */
  1669. X
  1670. X#define MenuIsNull(menu) (menu == NULLMENU)
  1671. X#define MenuIsDisplayed(menu) (menu->menuFlags & menuMapped)
  1672. X#define MenuHasInitialItem(menu) (menu->menuInitialItemText != (char *) NULL)
  1673. X
  1674. X/* Menu modifiers */
  1675. X
  1676. X#define SetHighlightItem(menu, item) (menu->highlightedItem = item)
  1677. X#define ResetHighlightItem(menu) (menu->highlightedItem = NULLITEM)
  1678. X#define    SetMenuEventHandler(menu,f)    menu->menuEventHandler = f
  1679. X#define SetMenuFlag(menu, flag)     MenuFlags(menu) |= flag
  1680. X#define ResetMenuFlag(menu,flag)    MenuFlags(menu) &= ~flag
  1681. X#define TestMenuFlag(menu,flag)     (MenuFlags(menu) & flag)
  1682. X#define TestOptionFlag(menu,option) (MenuOptions(menu) & option)
  1683. X
  1684. X/* Item data structure access macros */
  1685. X
  1686. X#define ItemFlags(item) (item)->itemFlags
  1687. X#define ItemText(item) (item)->itemText
  1688. X#define ItemTextLength(item) (item)->itemTextLength
  1689. X#define ItemTextWidth(item) (item)->itemTextWidth
  1690. X#define ItemNext(item) (item)->nextItem
  1691. X#define ItemSubmenu(item) (item)->itemSubmenu
  1692. X#define ItemTag(item) (item)->itemTag
  1693. X#define ItemGenerator(item) (item)->generator
  1694. X#define ItemGeneratorParamPointer(item) (item)->genParamPointer
  1695. X#define ItemCheckproc(item) (item)->checkproc
  1696. X#define ItemCallback(item) (item)->itemCallback
  1697. X#define ItemData(item) (item)->itemData
  1698. X#define ItemWindow(item) (item)->itemWindow
  1699. X#define ItemMenu(item) (item)->itemMenu
  1700. X#define NULLITEM ((MenuItem *) NULL)
  1701. X#define ItemGetArrowPosition(item) (item->itemMenu->menuWidth - arrow_width)
  1702. X
  1703. X/* Item predicates */
  1704. X#define ItemIsNull(item) (item == NULLITEM)
  1705. X#define ItemIsInitialItem(menu, item) \
  1706. X    (MenuInitialItemText(menu) && \
  1707. X     (strcmp(MenuInitialItemText(menu), ItemText(item)) == 0))
  1708. X#define ItemIsLeaf(item) ((item->itemSubmenu == (Menu *) 0) ? TRUE : FALSE)
  1709. X#define ItemIsDisabled(item) (ItemFlags(item) & itemDisabled)
  1710. X#define ItemIsDeaf(item) (ItemFlags(item) & itemDeaf)
  1711. X
  1712. X/* Item modifiers */
  1713. X
  1714. X#define    CheckItem(menu,item)    SetItemCheck(menu,item,1)
  1715. X#define    DisableItem(menu,item)    SetItemDisable(menu,item,1)
  1716. X#define    EnableItem(menu,item)    SetItemDisable(menu,item,0)
  1717. X#define    UncheckItem(menu,item)    SetItemCheck(menu,item,0)
  1718. X#define SetItemFlag(item, flag) ItemFlags(item) |= flag
  1719. X#define ResetItemFlag(item,flag) ItemFlags(item) &= ~flag
  1720. X#define TestItemFlag(item,flag) (ItemFlags(item) & flag)
  1721. X#define MoveItemFlag(item,flag1,flag2) \
  1722. X    if (TestItemFlag(item,flag1))\
  1723. X        SetItemFlag(item,flag2);\
  1724. X    else\
  1725. X        ResetItemFlag(item,flag2);\
  1726. X    ResetItemFlag(item,flag1);
  1727. X
  1728. X/* Masks */
  1729. X
  1730. X#define MenuEventMask (LeaveWindowMask | EnterWindowMask | ButtonReleaseMask)
  1731. X#define NormalItemEventMask MenuEventMask
  1732. X#define SubmenuItemEventMask (MenuEventMask | PointerMotionMask)
  1733. X#define MenuIgnoreMask (unsigned long) 0
  1734. X
  1735. X/* Magic numbers */
  1736. X
  1737. X#define    checkMarkWidth        9
  1738. X#define    checkMarkHeight        8
  1739. X#define    defaultCursorWidth     16
  1740. X#define    defaultCursorHeight    16
  1741. X#define    defaultCursorX        1
  1742. X#define    defaultCursorY        1
  1743. X#define    lineSeparatorHeight    9
  1744. X
  1745. X/* external declarations */
  1746. X
  1747. Xextern Menu *NewMenu();
  1748. Xextern MenuItem *TrackMenu ();
  1749. Xextern MenuItem *MenuItemByName (), *Display_Menu(); 
  1750. Xextern void InitMenu ();
  1751. Xextern void DisposeMenu ();
  1752. Xextern void Draw_Menu();
  1753. X#endif MENU_DEF_INCLUDE
  1754. END_OF_FILE
  1755. if test 6570 -ne `wc -c <'menus/menu.def.h'`; then
  1756.     echo shar: \"'menus/menu.def.h'\" unpacked with wrong size!
  1757. fi
  1758. # end of 'menus/menu.def.h'
  1759. fi
  1760. echo shar: End of archive 8 \(of 12\).
  1761. cp /dev/null ark8isdone
  1762. MISSING=""
  1763. for I in 1 2 3 4 5 6 7 8 9 10 11 12 ; do
  1764.     if test ! -f ark${I}isdone ; then
  1765.     MISSING="${MISSING} ${I}"
  1766.     fi
  1767. done
  1768. if test "${MISSING}" = "" ; then
  1769.     echo You have unpacked all 12 archives.
  1770.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1771. else
  1772.     echo You still need to unpack the following archives:
  1773.     echo "        " ${MISSING}
  1774. fi
  1775. ##  End of shell archive.
  1776. exit 0
  1777. -- 
  1778. Mike Wexler(wyse!mikew)    Phone: (408)433-1000 x1330
  1779. Moderator of comp.sources.x
  1780.